/ Assembly List / LJCNetCommon / HTMLBuilder / Create

Namespace - LJCNetCommon


Parameters
name - The element name.
text - The element content text.
textState - The current text state values.
htmlAttribs - The element attributes.
addIndent - Indicates if the element can be indented.
childIndent - Indicates if the child elements should be indented.
isEmpty - Indicates if an empty element.
close - Indicates if the element will be closed.

Returns

The added HTML element.

Syntax

C#
public String Create(String name, String text, TextState textState, Attributes htmlAttribs = null, Boolean addIndent = True, Boolean childIndent = True, Boolean isEmpty = False, Boolean close = True)

Appends an element.

Remarks

Create() is an "Append" method. It creates the element text with GetCreate() and adds it to the builder. The appended text does not end with a new line. This allows for additions after the text.
The added text will start with a new line if the builder text already has a value.

Example

C#
// Root Method Begin
var textState = new TextState();

// Defaults: IndentCharCount = 2, LineLimit = 80, WrapEnabled = false.
var hb = new HTMLBuilder(textState);

// Example Method:
var attribs = hb.StartAttribs();
// Defaults: close = true.
hb.Create("html", null, textState, attribs);
var result = hb.ToString();

// result:
// <html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\"><html>

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.